<?php
/**
 * <i>simple_text_format</i>定义
 * 
 * @version $Id: IMintSimpleTextFormatModifier.php 312 2008-04-23 16:29:38Z iwind $
 * @package util.mint.modifier
 * @since 0.0.2
 */
class IMintSimpleTextFormatModifier extends IAbstractMintModifier {
	/**
	 * 构造器
	 *
	 */	
	public function __construct() {
		
	}
	
	/**
	 * 执行
	 *
	 * @return scalar
	 */	
	public function execute(/** $string $charset  **/) { 
		$string = $this->getVariable();
		$arguments = $this->getArguments();
		$charset = isset($arguments[0])?$arguments[0]:null;
		if ($charset == null) {
			$string = htmlspecialchars($string);
		}
		else {
			$string = htmlspecialchars($string, null, $charset);
		}
		$string = str_replace(" ", "&nbsp;", $string);
		$string = str_replace("\t", "&nbsp;&nbsp;&nbsp;&nbsp;", $string);
		$string = nl2br($string);
		return $string;
	}
}

?>